
#*--encoding:UTF-8--*

'''
整理数据
'''

from common.helper import Helper
from db.mysql import MysqlClient

class Arrangement( object ):

    def __init__(self):
        self.mysql = MysqlClient()
        self.name = "华夏常青藤防癌医疗保险"

    def pullData(self, data={}):
        for item in Helper.selectData(self.name, self.mysql):

            data["name"] = self.name
            data["company"] = "华夏保险"
            data["year"] = item["year"]
            data["gender"] = "1" if item["gender"] == "0" else "0"
            data["expire"] = item["interval"] + "年"
            data["interval"] = str(item["paytime"])
            data["payType"] = "年交"
            data["money"] = item["feedback"] + "w"
            data["defineCancer"] = "1" if item["pre_cancer"] == 1 else "0"
            data["extSerious"] = "1" if item["ext_some"] == 1 else "0"
            data["price"] = item["price"]
            Helper.mergeTable(self.name, self.mysql, data)